<%--
  Created by IntelliJ IDEA.
  User: hklyq
  Date: 2019/1/9
  Time: 上午9:18
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%String path = request.getContextPath();%>
<%@ taglib uri="/WEB-INF/tld/c.tld" prefix="c" %>
<%@ taglib uri="/WEB-INF/tld/ui.tld" prefix="ui" %>
<%@ taglib uri="/WEB-INF/tld/sys.tld" prefix="sys" %>
<html>
<head>
    <title>操作原因</title>
    <jsp:include page="../../import.jsp" flush="true"/>
</head>
<body class="">
<form id="rskCstSignLog_deleteReason">
    <br>
    <div class="fieldBox col_100" style="text-align: center">
        <div class="field">
                <textarea name="signRem" id="signRem" type="text" class="ui-textarea l-textarea" cols="80" rows="10"
                          value=""
                          validate="{required:true,maxlength:255}"></textarea>
        </div>
    </div>
    <div class="btnsBox" style="text-align: center">
        <span id="saveRskCstSignLogDeleteReason_Btn" class="sq-button sq-button-round l-dialog-btn-ok">确定</span>
        <span id="cancelBtn" class="sq-button sq-button-round co_normal l-dialog-btn-cancel">取消</span>
        <input type="reset" id="resetBtn" class="l-button l-button-reset Hide">
    </div>
</form>
<script type="text/javascript">
    var ids = '${ids}';
    var cstIds = '${cstIds}';
    var rskSign = '${rskSign}';
    // 获取字符串的字节长度
    function getByteLen(str) {
        var len = 0;
        for (var i = 0; i < str.length; i++) {
            var a = str.charAt(i);
            if (a.match(/[^\x00-\xff]/ig) != null) {
                len += 2;
            } else {
                len += 1;
            }
        }
        return len;
    }

    /*保存*/
    $("#saveRskCstSignLogDeleteReason_Btn").click(function (event) {
        var signRem = $("#signRem").val();
        if (signRem == null || signRem == '') {
            $.ligerDialog.SQalert({content: LogUtils.LOG_CMM_MUST_FIX_ITEM_INFO, SQ_type: "warning"});
            return false; //验证不通过，不执行以下代码
        }
        // var signRem = $("#signRem").val();
        var signRenLength = getByteLen(signRem);
        if (signRenLength >= 255) {
            $.ligerDialog.SQalert({content: LogUtils.LOG_CMM_MUST_FIX_SIGNREM_LENGTH, SQ_type: "warning"});
            return false; //验证不通过，不执行以下代码
        }
        $.ligerDialog.hide();
        var _url = '<%=path%>/risk/rskCstSignLog/removeByIds.do';
        var wait_dialog;
        $.ajax({
            type: 'post',
            dataType: 'json',
            data: {
                signRem: signRem,
                ids: ids,
                cstIds: cstIds,
                rskSign: rskSign
            },
            url: _url,
            beforeSend: function () {
                wait_dialog = $.ligerDialog.SQalert({content: LogUtils.LOG_CMM_DATA_LOADING, SQ_type: "waitting"});
            },
            success: function (msg) {
                wait_dialog.close();
                if (msg.success == 1) {
                    parent.$.ligerDialog.SQalert({content: msg.info, SQ_type: "success"});
                    parent.$("#clearBtn").click();
                    parent.$("#searchBtn").click();
                    frameElement.dialog.close();
                } else {
                    $.ligerDialog.SQalert({content: msg.info, SQ_type: "error"});
                }
            }
        });
    });

</script>

</body>
</html>
